<?
/**
 * Logs out from the page and removes the session id from the database
 * 
 * @author Sean
 */
 
if(isset($_GET['googleId']))
{

	// *****************
	// LOGOUT FUNKTIONEN
	// *****************
	session_start();
	session_destroy();

	include ("connect.php");
	// define('SERVER_HOST', 'sean.servern.org/webdrop');

	// define('MYSQL_HOST', 'localhost');
	// define('MYSQL_USERNAME', 'webdrop');
	// define('MYSQL_PASSWORD', 'webdrop');
	// define('MYSQL_CHARSET', 'utf-8');
	// define('MYSQL_DATABASE', 'webdrop');

	// @mysql_connect(MYSQL_HOST, MYSQL_USERNAME, MYSQL_PASSWORD) or die('Unable to connect to database.');
	
	$GoogleID = $_GET['googleId'];
	$GoogleID = mysql_real_escape_string($GoogleID);
	
	// Ensure correct charset
	// mysql_set_charset(MYSQL_CHARSET); 
	
	// @mysql_select_db(MYSQL_DATABASE) or die("Unable to select database.");
	
	mysql_query("UPDATE users SET sessionID = '" . null . "' WHERE googleID = '" . $GoogleID . "'") or die("Unable to select database.");
	
	mysql_close();
	
	header('Location: http://sean.servern.org/webdrop/Webdrop.html#page=login');
	
}

?>